<template>
  <nav class="navbar navbar-dark bg-primary justify-content-between mb-4 px-4">
    <a class="navbar-brand">专栏</a>

    <ul v-if="!user.isLogin" class="list-inline mb-0">
      <li class="list-inline-item"><router-link class="btn btn-outline-light my-2" to="/login">登录</router-link></li>
      <li class="list-inline-item"><router-link class="btn btn-outline-light my-2" to="/signup">注册</router-link></li>
    </ul>
    <ul v-else class="list-inline mb-0">
      <li class="list-inline-item">
        <dropdown :title="`你好 ${user.nickName}`">
          <router-link class="dropdown-item" to="/create">新建文章</router-link>
          <!--          <router-link class="dropdown-item">我的专栏</router-link>-->
        </dropdown>
      </li>
    </ul>
  </nav>
</template>

<script lang="ts" setup>
import { defineProps, PropType } from "vue";
import { UserProps } from "../types";
import Dropdown from "./Dropdown.vue";

defineProps({
  user: {
    type: Object as PropType<UserProps>,
    required: true,
  },
});
</script>
